<template>
    <button class="ui circular icon button tiny" @click.prevent="addCk()">新增仓库<i class="icon plus"></i>
    </button>
</template>

<script type="text/ecmascript-6">
  import tool from 'src/util/tool';
  import util from '_util/index';
  import logic from '_logic';
  import model from '_model';


  export default {
    data() {
      return {
        val: '',
      }
    },
    components: {},
    methods: {
      addCk() {
        logic.edit.showEditPop(this, 44, ()=> {

          let vo = util.store.get(this, 'editVoModal');

          let url = tool.getApi(this, 'Warehouse', 'insert');

          util.getDataCom(this, url, vo, (rs) => {
            let product_id = util.store.get(this, 'product_id', 'product');
            util.showMsg(this, 'success', '新增仓库成功!',null,()=>{
              model.Warehouse.chooseProductAttr(this,rs.id,product_id);
            });
          }, (data,msg)=> {
            msg = data ? `${data.errmsg}(${data.debug})` : msg;
            util.showMsg(this, 'error', msg);
          });

        });
      },
    },
    watch: {
    },
    computed: {
    },
    props: ['field'],
    created() {
    },
    mounted() {
    }
  };
</script>

<style scoped>
</style>
